package com.designpatterns.command.test;

import com.designpatterns.command.command.ceiling.CeilingFanHighCommand;
import com.designpatterns.command.command.ceiling.CeilingFanMediumCommand;
import com.designpatterns.command.command.ceiling.CeilingFanOffCommand;
import com.designpatterns.command.control.RemoteControlWithUndo;
import com.designpatterns.command.entity.CeilingFan;

/**
 * @author Brook
 */
public class RemoteLoader2 {
    public static void main(String[] args) {
        RemoteControlWithUndo remoteControlWithOndo = new RemoteControlWithUndo();

        CeilingFan ceilingFan = new CeilingFan("living_room");

        CeilingFanMediumCommand ceilingFanMediumCommand = new CeilingFanMediumCommand(ceilingFan);
        CeilingFanHighCommand ceilingFanHighCommand = new CeilingFanHighCommand(ceilingFan);
        CeilingFanOffCommand ceilingFanOffCommand = new CeilingFanOffCommand(ceilingFan);

        remoteControlWithOndo.setCommand(0, ceilingFanMediumCommand, ceilingFanOffCommand);
        remoteControlWithOndo.setCommand(1, ceilingFanHighCommand, ceilingFanOffCommand);


        remoteControlWithOndo.onButtonWasPushed(0);
        remoteControlWithOndo.offButtonWasPushed(0);
        System.out.println(remoteControlWithOndo);
        remoteControlWithOndo.undoButtonWasPushed();

        remoteControlWithOndo.onButtonWasPushed(1);
        System.out.println(remoteControlWithOndo);
        remoteControlWithOndo.undoButtonWasPushed();


    }
}
